<?php

namespace seecms\develop\provider;

use seecms\develop\config\DevelopConfig;
use seecms\lib\Auth;
use seecms\See;

class  User extends \seecms\lib\provider\User
{

    /**
     * 重置菜单
     * @return array
     * @throws \Psr\Cache\InvalidArgumentException
     * @throws \seecms\db\SeeDbException
     */
    public function menu(): array
    {
        $menus = parent::menu();

        if (DevelopConfig::switch() && Auth::user()->isRoot()) {
            $menus[] = [
                'id' => 900000,
                'parent_id' => 0,
                'name' => 'develop',
                'title' => '模块管理',
                'icon' => 'iconfont icon-equalizer-line',
                'type' => 1,
                'openType' => NULL,
                'href' => auth_route('develop/module'),
                'spacer' => '',
            ];
            $menus[] = [
                'id' => 1000000,
                'parent_id' => 0,
                'name' => 'develop',
                'title' => '开发工具',
                'icon' => 'iconfont icon-equalizer-line',
                'type' => 1,
                'openType' => NULL,
                'href' => '',
                'spacer' => '',
                'childlist' => [
                    [
                        'id' => 1000005,
                        'parent_id' => 1000000,
                        'name' => 'develop.trans',
                        'title' => '数据表提取',
                        'icon' => 'iconfont icon-history',
                        'type' => 1,
                        'openType' => NULL,
                        'href' => auth_route('develop/model'),
                        'childlist' => []
                    ],
                    [
                        'id' => 1000010,
                        'parent_id' => 1000000,
                        'name' => 'develop.mock',
                        'title' => 'Mock',
                        'icon' => 'iconfont icon-history',
                        'type' => 1,
                        'openType' => NULL,
                        'href' => auth_route('develop/mock'),
                        'childlist' => []
                    ],
                    [
                        'id' => 1000020,
                        'parent_id' => 1000000,
                        'name' => 'develop.apiPost',
                        'title' => 'ApiPost文档',
                        'icon' => 'iconfont icon-history',
                        'type' => 1,
                        'openType' => NULL,
                        'href' => auth_route('develop/apiPost'),
                        'childlist' => []
                    ],
                    [
                        'id' => 1000025,
                        'parent_id' => 1000000,
                        'name' => 'develop.icon',
                        'title' => '图标库',
                        'icon' => 'iconfont icon-history',
                        'type' => 1,
                        'openType' => NULL,
                        'href' => auth_route('develop/icon'),
                        'childlist' => []
                    ],
                    [
                        'id' => 1000050,
                        'parent_id' => 1000000,
                        'name' => 'develop.icon',
                        'title' => '日志',
                        'icon' => 'iconfont icon-history',
                        'type' => 1,
                        'openType' => '_blank',
                        'href' => 'http://seecms.com/admin/develop/log',
                        'childlist' => []
                    ]
                ],
            ];
        }

        return $menus;
    }
}